package com.hanyxx.coll;

import java.util.Collection;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;

/**
 * @author layman
 * @date 2021/2/26
 */
public class Demo07 {
    public static void main(String[] args) {
        Map<String,Integer> map = new HashMap<>();
        map.put("钢铁侠",35);
        map.put("蜘蛛侠",18);
        map.put("黑寡妇",29);
        map.put("惊奇队长",35);

        map.entrySet();
        //只遍历key
        Set<String> set = map.keySet();
        for (String key : set) {
            System.out.println(key);
        }
        //只遍历value
        Collection<Integer> values = map.values();
        for (Integer value : values) {
            System.out.println(value);
        }
    }
}
